package com.morpheus.zookeeper.cluster;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.ImportSelector;
import org.springframework.core.type.AnnotationMetadata;

import com.morpheus.zookeeper.api.client.ZookeeperClient;
import com.morpheus.zookeeper.api.election.CuratorLeaderElectionListener;
import com.morpheus.zookeeper.api.election.CuratorLeaderLatchListener;
import com.morpheus.zookeeper.api.guid.ZookeeperWorker;
import com.morpheus.zookeeper.api.lock.multi.MultiDistributedLock;
import com.morpheus.zookeeper.api.lock.single.SingleDistributedLock;

public class ZookeeperClusterImportSelector implements ImportSelector {
	private static final Logger LOGGER = LoggerFactory.getLogger(ZookeeperClusterImportSelector.class);

	public ZookeeperClusterImportSelector() {
	}

	@Override
	public String[] selectImports(AnnotationMetadata importingClassMetadata) {
		String[] imports = new String[] { SingleDistributedLock.class.getName(), MultiDistributedLock.class.getName(),
				ZookeeperWorker.class.getName(), ZookeeperClient.class.getName(),
				CuratorLeaderElectionListener.class.getName(), CuratorLeaderLatchListener.class.getName() };
		LOGGER.info("ZookeeperClusterImportSelector.selectImports() imports={}", new Object[] { imports });
		return imports;
	}
}
